'use strict';


/* Controllers */

/*var blogControllers = angular.module('blogControllers', []);

blogControllers.controller  ('EntryList', ['$scope', '$http',
    function($scope, $http) {
        $http.get('entries').success(function(data) {
        $scope.entries = data;
        });
      }
    ]);*/

// Change to $routeParams when using ngRoute module instead of ui.router
/*blogControllers.controller('modifyEntry', ['$scope', '$http', '$stateParams',
   function($scope, $http, $stateParams){
       $http.get('entries/'+$stateParams.entryId).success(function(data) {
        $scope.entry = data;
       });
   }
]);*/

/*blogControllers.controller('submitCtrl',['$scope', '$http','$state',
    function($scope, $http,$state) {

        $scope.submitForm = function() {

            var entry = {};

            entry.title = this.title;
            entry.body = this.body;
            console.log("Submitting");

            var data = JSON.stringify(entry);
            $http({
                    url: 'entries/addEntry',
                    method: "POST",
                    data: data,
                    headers: {'Content-Type': 'application/json'}
            });

            $state.go('list', null, {reload:true}  );



        };

        $scope.updateForm = function() {

            var entry = {};
            entry.id = this.entry.id;
            entry.title = this.entry.title;
            entry.body = this.entry.body;
            console.log("Saving changes");

            var data = JSON.stringify(entry);
            $http({
                url: 'entries/'+entry.id+'/updateEntry',
                method: "PUT",
                data: data,
                headers: {'Content-Type': 'application/json'}
             });

             $state.go('list', null, {reload:true}  );

        };


    }
]);*/

/*
blogControllers.controller  ('deleteCtrl', ['$scope', '$http','$state',
    function($scope, $http, $state) {
        $scope.delete = function(id) {
            $http({
               url: 'entries/'+id,
               method: "delete",
               }).success(function() {
                console.log("Deleted");
            });
            $state.go('list', null, {reload:true});
            ;
        };
      }
    ]);

*/




